<template>
	<view class="deviceInfo">
		<u-navbar title="仪器信息" back-icon-color="#fff"
			:background="{backgroundImage: 'linear-gradient(45deg, #68dae7, #21a4b3)'}" title-color="#FFFFFF">
		</u-navbar>
		<u-cell-group>
			<u-cell-item icon="" title="资产编号" :value="device.assetNumber" :arrow="false"></u-cell-item>
			<u-cell-item icon="" title="仪器名称" :value="device.deviceName" :arrow="false"></u-cell-item>
			<u-cell-item icon="" title="仪器型号" :value="device.deviceType" :arrow="false"></u-cell-item>
			<u-cell-item icon="" title="序列号" :value="device.serialNumber" :arrow="false"></u-cell-item>
			<u-cell-item icon="" title="负责人" :value="device.owner?device.owner:''" :arrow="false"></u-cell-item>
			<u-cell-item icon="" title="负责人电话" :value="device.phone?device.phone:''" :arrow="false"></u-cell-item>
			<u-cell-item icon="" title="巡检周期(天)" v-if="device.isXj == 2" :value="device.xjCycle" :arrow="false"></u-cell-item>
			<u-cell-item icon="" title="保养周期(天)" v-if="device.isBy == 2" :value="device.byCycle" :arrow="false"></u-cell-item>
			<u-cell-item icon="" title="核查周期(天)" v-if="device.isHc == 2" :value="device.hcCycle" :arrow="false"></u-cell-item>
		</u-cell-group>
		<!-- <view class="deviceInfo-list">
			<view class="deviceInfo-list-title">配置清单:</view>
			<view class="deviceInfo-list-item">清单1</view>
			<view class="deviceInfo-list-item">清单2</view>
			<view class="deviceInfo-list-item">清单3</view>
		</view> -->
		<view class="deviceInfo-list" style="padding-top: 0;">
			<view class="deviceInfo-list-title">仪器照片:</view>
			<image class="devicePng" mode="widthFix" @click="previewImage(device.photo)" :src="device.photo"></image>
			<!-- <image class="devicePng" mode="widthFix" @click="previewImage(`/static/images/deviceInfo1.jpg`)" src="/static/images/deviceInfo1.jpg"></image> -->
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				device: {
				},
				photoList:[],
				sn:"",
			}
		},
		onLoad(options) {
			this.sn = options.deviceSn
			this.getData()
		},
		methods:{
			getData(){
				let params = {
					sn:this.sn
				}
				this.$xt.api.deviceinfo(params).then(res=>{
					this.device = res.data
					this.photoList.push(res.data.photo)
				})
			},
			previewImage(url){
				uni.previewImage({
					current: url,
					urls:this.photoList
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.deviceInfo{
		&-list{
			background-color: #fff;
			padding: 13px 32rpx;
			color:#585858;
			&-item{
				padding-left: 24rpx;
				margin-top: 12rpx;
			}
		}
		.devicePng{
			width: 100%;
		}
	}
</style>